dim ncount:ncount=0
main
msgbox ncount
sub main()
	on error resume next
	Dim doc
	Set doc = application.ActiveDocument
	GetUserLicence(doc)	
	
	dim ostr:ostr = ""
	Dim NColorObject
	set NColorObject = application.utility.NewColorPattern 
	With NColorObject
				.red = 255
				.green =255
				.blue =255
				.index =1
				.outline=false
				.Transparent=false
	end With
	
	dim pcbnet,pcbnets
	set pcbnets= doc.nets(0)
	dim ppins
	for each pcbnet in pcbnets
		set ppins = pcbnet.pins(0)		
		if ppins.count = 1 then
			doc.activeView.DisplayControl.Global.Net("True",pcbnet.name)=true
			set doc.ActiveView.DisplayControl.Global.NetColor("True",pcbnet.name) = NColorObject
			
			if ostr<>"" then ostr = ostr & vbCrlf
			ostr = ostr & pcbnet.name
			ncount = ncount+1
		end if
	next
	call SetClipboardText_fm20(ostr)
	
end sub
''' copy and paste
Function SetClipboardText_fm20(oText)   '剪切读取板信息
    Dim Form, TextBox
	Set Form = CreateObject("Forms.Form.1") 
	Set TextBox = Form.Controls.Add("Forms.TextBox.1").Object 
	TextBox.MultiLine = True 
	TextBox.Text = oText
	TextBox.SelStart = 0 
	TextBox.SelLength = TextBox.TextLength 
	TextBox.Copy
End Function
Private Function ValidateServer(docObj)
	Dim key, licenseServer, licenseToken
	key = docObj.Validate(0)
	Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")
	licenseToken = licenseServer.GetToken(key)
	Set licenseServer = nothing
	Err.Clear
	docObj.Validate(licenseToken)
	If Err Then
	ValidateServer = 0
	Else
	ValidateServer = 1
	End If
End Function
sub GetUserLicence(docObj)
	If ValidateServer(docObj) = 0 Then
	    msgbox "Server validation failed."
	    exit sub
	End If	
end sub